/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hxg.portmgr.core.device.intf;

/**
 *
 * @author hxg
 */
public enum IntfType {

    EthPortIntf {

        @Override
        public String getDescibe() {
            return "EtherNet接口";
        }

        @Override
        public int[] getTypeValueRange() {
            return new int[]{6, 117};
        }
    }, AdslIntf {

        @Override
        public String getDescibe() {
            return "ADSL接口";
        }

        @Override
        public int[] getTypeValueRange() {
            return new int[]{94};
        }
    }, VLAN {

        @Override
        public String getDescibe() {
            return "VLAN接口";
        }

        @Override
        public int[] getTypeValueRange() {
            return new int[]{135, 136};
        }
    }, Other {

        @Override
        public String getDescibe() {
            return "尚未定义类型的接口";
        }

        @Override
        public int[] getTypeValueRange() {
            return new int[]{0};
        }
    }, Empty {

        @Override
        public int[] getTypeValueRange() {
            return new int[]{-1};
        }

        @Override
        public String getDescibe() {
            return "用于特别定义在SNMP扫描中存在，但在实际软硬件中无对应的接口";
        }
    ;

    };

    public abstract int[] getTypeValueRange();

    public abstract String getDescibe();

    public static IntfType getTypeByValue(int key) {
        switch (key) {
            case 94:
                return AdslIntf;
            case 6:
                return EthPortIntf;  //标准
            case 117:
                return EthPortIntf;  //GigiEther
            case 135:
                return VLAN;
            case 136:
                return VLAN;  //
            case -1:
                return Empty;
            default:
                return Other;
        }
    }
}
